package com.itheima.tlias.mapper;

import com.github.pagehelper.Page;
import com.itheima.tlias.dto.CheckStudentDto;
import com.itheima.tlias.entity.Student;
import com.itheima.tlias.vo.NameValueVo;
import com.itheima.tlias.vo.StudentVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface StudentMapper {

    @Select("select * from student where clazz_id =#{clazzId} ")
    List<Student> studentByClazzId(Integer clazzId);

    Page<StudentVo> studentPage(CheckStudentDto dto);


    void deleteStudents(List<Integer> ids);

    void addStudent(Student student);

    @Select("select * from student where no=#{no}")
    Student studentByNo(String no);

    @Select("select * from student where phone=#{phone}")
    Student studentByPhone(String phone);

    @Select("select * from student where id_card=#{IdCard}")
    Student studentByIdCard(String student);

    @Select("select * from student where id= #{id}")
    StudentVo getById(Integer id);

    void updateStudent(Student dto);

    void violateDiscipline(@Param("id") Integer id, @Param("score") Integer score);

    List<NameValueVo> studentDegreeData();

    List<NameValueVo> studentCountData();
}
